package kof 
{
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.Sprite;
	import flash.display.StageDisplayState;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.text.TextField;
	import flash.text.TextFieldType;
	import iscript.coreFramework.debug.MovieMonitor;
	import iscript.gameFramework.GameLite.events.GameContentEvent;
	import iscript.gameFramework.GameLite.events.KeyInputEvent;
	import iscript.gameFramework.GameLite.Game;
	import iscript.gameFramework.GameLite.graphics.animation.BitmapBatch;
	import iscript.gameFramework.GameLite.graphics.bitmaps.BitmapDataIncision;
	import iscript.gameFramework.GameLite.input.KeyInputData;
	
	
	public class GameKof extends  Sprite
	{
		
		//private var _kofswf:
		
		public function GameKof() 
		{
			
			var game:Game = new Game(stage)
			
			stage.addEventListener(MouseEvent.CLICK,full)
			
			Game.Content.addGameContentListener("kof.swf",loadLogic)
			Game.Content.addSwf("kof.swf")
			Game.keyInput.addEventListener(KeyInputEvent.RELEASEKEYGROUP, _getKeyGroup)
			
			
		
			
		}
		
		private function full(e:MouseEvent):void 
		{
			stage.displayState =  StageDisplayState.FULL_SCREEN;
		}
		
		private function _getKeyGroup(e:KeyInputEvent):void 
		{
			trace(e.keysIntValue)
			
			t.text += e.keysIntValue;
			//65,83,68,74
			
			var power:String="65,83,68,74"
			power = "83_3,87,74"
			
			//power = "65_3,83,87,74"
			
			
		if (Game.keyInput.matchKeyGroupData(e.keyGroupData, power)) {
			trace("草雉京: 超技零式")
			t.text += "草雉京: 超技零式";
			}
			
			
			trace("MATCH:",Game.keyInput.matchKeyGroupData(e.keyGroupData, power));
			
			
			/*for each ( var item:KeyInputData  in e.keyGroupData) {
				
				trace(item.keyCode+">>>"+item.keepDownCount)
				
				}
				
		    var data:Vector.<KeyInputData> = new Vector.<KeyInputData>();*/
			 
			   
			/*var dataArr:Array = [
			                    [65,1],
			                    [83,1],
			                    [68,2],
			                    [83,1],
			                    [65,1]
			                  ]
			*/
		/*	var  dataJson:Object = [
										{"keycode":65,"keepdownCount":1},
										{"keycode":83,"keepdownCount":1},
										{"keycode":68,"keepdownCount":2},
										{"keycode":83,"keepdownCount":1},
										{"keycode":65,"keepdownCount":1}
			                       ]
				                   				  
			trace(dataJson)*/
			
		}
		
		
		private var  kyo:BitmapBatch;
		
		private function loadLogic(e:GameContentEvent):void 
		{
			
			addChild(Game.Content.getMovieClipByClass("StageBackground"))
			
			
			var data:Vector.<BitmapData> = new Vector.<BitmapData>();
			
			var imageStand:Bitmap = new Bitmap(Game.Content.getBitmapDataByClass("Stand"));
			
			var bmi:BitmapDataIncision = new BitmapDataIncision(Game.Content.getBitmapDataByClass("Stand"));
			    bmi.split(192,192)
			    bmi.appendToData(data);
				
			kyo = new BitmapBatch(data);
			kyo.play();
			kyo.scaleX = 2
			kyo.scaleY = 2
			kyo.y = stage.stageHeight - kyo.height;
			addChild(kyo)
				
				
			addChild(new MovieMonitor())
			
			
			    t.text = "1";
				t.y = 400;
				t.type = TextFieldType.INPUT
				t.opaqueBackground = 0xFFFFFF;
				addChild(t)
		}
		private	var t:TextField = new TextField();
		
		
		
		
	}

}